<template>
	<view class="mainpadding" v-if="pageShow">
		<view class="xiahuaxian mainpadding ffffff radius">
			<view class="flexbetween">
				<view class="shilitu margin_right1">
					<image :src="dataAll.image_text" mode=""></image>
				</view>
				<view class="" style="width: 69%;">
					<view class="titletext xiaohei fonweight yhxk">{{dataAll.name}}</view>
					<view class="strongtext xiaohui nofonweight  margin_top">
						创建时间：{{dataAll.createtime_text}}</view>
				</view>
			</view>
			<!-- <view class="strongtext xiaohui nofonweight margin_top2 yhxk">{{dataAll.ss.cityinfo}}{{dataAll.ss.address}}</view> -->
			<!-- <view class="flexleft margin_top2">
				<view class="huibtn margin_right1 yhxk" v-for="(ite,inde) in item.cg_bq_ids_text" :key="inde" v-if="inde<2">{{ite}}</view>
			</view> -->
		</view>
		<view class="mainpadding_top ffffff radius">
			<view class="titletext sanshier fonweight">报名信息</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">姓名：</view>
				<view class="strongtext">{{dataAll.username}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">手机号：</view>
				<view class="strongtext">{{dataAll.usermobile}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">场次：</view>
				<view class="strongtext">{{dataAll.cgordercgb.start_time1}}-{{dataAll.cgordercgb.end_time}}</view>
			</view>
		</view>
		<view class="gudingdb mainpadding">
			<view class="bigbtn" @click="hexiao">确认核销</view>
		</view>
		<moDal :message="modal" @modalSure="modalSure" @modalcancel="modalcancel"></moDal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid:"",
				child_id:"",
				dataAll:{},
				modal:{
					modalShow:false,
					title:"是否确认核销？",
				},
				pageShow:false
			}
		},
		onLoad(options) {
			// #ifdef MP-WEIXIN
			let _this = this
			const url = decodeURIComponent(options.q) // 获取到二维码原始链接内容
			if (url.indexOf("?") != -1) {
				var str = url.substr(url.indexOf("?") + 1);
				var strs = str.split("&");
				let theRequest = {};
				for (var i = 0; i < strs.length; i++) {
					theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
				}
				_this.listid = options.hxid ? options.hxid : (theRequest.hxid ? theRequest.hxid :
					0);
				_this.child_id = options.child_id ? options.child_id : (theRequest.child_id ? theRequest.child_id :
					0);
			}
			// #endif
		},
		onShow() {
			if (!httpRequest.checkIsLogin()) {
				uni.navigateTo({
					url: "/pages/login/login"
				})
				return false
			}
			this.getdetail()
		},
		methods: {
			modalSure(){
				if(this.modal.title=="是否确认核销？"){
					httpRequest.request("/api/cgcl/cgHx", 'GET', {
						cg_order_id:this.listid,
						cg_order_cgb_id:this.child_id
					}).then(res => {
						httpRequest.toast(res.msg)
						setTimeout(()=>{
							uni.reLaunch({
								url:"/pages/homepage"
							})
						},1000)
					})
				}
				this.modalcancel()
			},
			modalcancel(){
				this.modal.modalShow = false
			},
			hexiao(){
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				this.modal.modalShow=true
			},
			getdetail(){
				httpRequest.request("/api/cgcl/hxOrderDetail", 'GET', {
					cg_order_id:this.listid,
					cg_order_cgb_id:this.child_id
				}).then(res => {
					if(res.code==1){
						this.dataAll = res.data
						this.pageShow = true
					}else{
						httpRequest.toast(res.msg)
						setTimeout(()=>{
							// uni.reLaunch({
							// 	url:"/pages/homepage"
							// })
						},1000)
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fafafa;
	}
	.xiaohbtn {
		width: 100rpx;
		height: 40rpx;
		background: #BAC3D5;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #091636;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.xiaolabtn {
		width: 80rpx;
		height: 40rpx;
		background: #078CE6;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
.shilitu {
		width: 200rpx;
		height: 160rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
	.xiaolhbtn {
		width: 80rpx;
		height: 40rpx;
		background: #1BA95B;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.xiaojubtn {
		width: 80rpx;
		height: 40rpx;
		background: #F8B900;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.xiaocbtn {
		width: 80rpx;
		height: 40rpx;
		background: #F76222;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		font-size: 20rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
</style>
